package kafka

import java.sql.{Connection, DriverManager}

object MySQLConnect{
  private var connection: Connection = _
  private val driver = "com.mysql.cj.jdbc.Driver"
  private val url = "jdbc:mysql://www.91iedu.com:3391/tjpu1904?userUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&userSSL=false"
  private val username = "tjpu1904"
  private val password = "tjpu1904"

  def conn():Connection = {
    if (connection == null){
      println(this.driver)
      Class.forName(this.driver)
      connection = DriverManager.getConnection(url, username, password)
    }
    connection
  }
}